﻿@model ZJK.Models.ExtractManage.vmExtract
@{
    ViewBag.Title = "专家抽取";
}
@Styles.Render("~/Scripts/ztree/zTreeStyle.css")
@Scripts.Render("~/Scripts/ztree/jquery.ztree.all-3.5.min.js")
<script type="text/javascript" src="@Url.Content("~/Scripts/jQuery.tmpl.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/Extract/doExtract.js")"></script>
<script type="text/javascript">
    //定义地址
    //定义根据抽取记录ID，导出Excel的地址
    var strUrlexportExtractRecordToExcel = '@Url.Content("~/Extract/exportExtractRecordToExcel")';
    //定义根据抽取记录ID，返回该记录的抽取详细记录的地址
    var strUrlgetExtractDetails = '@Url.Content("~/Extract/getExtractDetails")';
    //定义根据抽取详细记录ID，返回该记录的抽取详细记录的地址
    var strUrlgetExtractDetail = '@Url.Content("~/Extract/getExtractDetail")';
    //定义根据抽取详细记录ID，返回该记录的抽取详细记录的地址
    var strUrlsaveExtractDetail = '@Url.Content("~/Extract/saveExtractDetail")';
    //定义新建抽取结果记录的地址
    var strUrlnewAExtractDetail = '@Url.Content("~/Extract/newAExtractDetail")';

    //定义根据抽取选项条件查询专家列表的地址
    var strUrlgetExpertsBX = '@Url.Content("~/Extract/getExpertsBXByThisOption")';

    //定义获取专家分类列表的地址
    var strUrlgetCategorys = '@Url.Content("~/Extract/getCategorysJson")';

    $(document).ready(function () {
        // 初始化折叠控件
        $("#accordion").accordion({ header: "h3", autoHeight: false, heightStyle: "content", collapsible: true });

        //初始化专家分类树形
        getCategorys(strUrlgetCategorys);

        //初始化当前记录的结果
        getExtractDetails($("#extractID").val());

        //初始化编辑抽取详细记录的弹出框
        $("#FormEdit").dialog({
            autoOpen: false,
            height: 530,
            width: 600,
            resizable: false,
            modal: true,
            draggable: true,
            title: "抽取记录详细信息",
            buttons: {
                "取消": function () { $(this).dialog("close"); },
                "保存修改": function () { saveThisDetail($("#FormEditDetail_Id").val()); }
            }
        });
    });

</script>
<h2>专家抽取</h2>
<input type="hidden" id="extractID" value="@Model.extractRecordID" />
<div id="accordion">
    <!-- 关联项目列表 -->
    <div>
        <h3>
            <a href="#">1、关联项目列表</a></h3>
        <div>
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    <b>抽取记录标题：</b>
                </div>
                <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; top: 0px; padding: 0.7em 0.4em;">
                    @Model.extractRecordTitle
                </div>
                <div class="clear">
                </div>
            </div>
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    <b>抽取关联项目列表：</b>
                </div>
                <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; top: 0px; padding: 0.7em 0.4em;">
                    <div id="project_list">
                        @foreach (var _p in @Model.extractRecordSelectedProjects)
                        {
                            <p>
                                <span>[</span><span>@_p.projectCode</span><span>]</span><span>@_p.projectName</span>
                            </p> 
                        }
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
    </div>
    <!-- 抽取选项 -->
    <div>
        <h3>
            <a href="#">2、抽取选项</a></h3>
        <div>
            <!-- 专家所在区域 -->
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    <b>2.0、专家所在：</b>
                </div>
                <div class="ui-corner-all" style="width: 25%; float: right; padding: 0.7em;">
                    <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                    选择：当前专家所在区域；
                </div>
                <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; margin-right: 28%; top: 0px; padding: 0.7em;">
                    <!--选择城市功能      star      -->
                    <script type="text/javascript" src="@Url.Content("~/Content/Area_mini.js")"></script>
                    <script type='text/javascript'>
                        $(document).ready(function () {
                            $("#zjAreaProvince").change(function () {
                                LoadCity();
                                //LoadCounty();
                            });

                            /*
                            $("#zjAreaCity").change(function () {
                            LoadCounty();
                            });
                            */

                            LoadArea('广西', '柳州');
                        });

                        function LoadArea(prov, city) {
                            LoadProvince(prov);
                            LoadCity(city);

                        }
                        function LoadProvince(values) {
                            $("#zjAreaProvince").empty();
                            for (var id in countryAreaData) {

                                $("#zjAreaProvince").append(" <option value='" + id + "'>" + id + "</option>");

                            }
                            if (typeof (values) == "string") {
                                $("#zjAreaProvince option[value=" + values + "]").attr("selected", true)
                            }
                        }
                        function LoadCity(values) {
                            $("#zjAreaCity").empty();
                            var s1 = $("#zjAreaProvince option:selected").val();
                            for (var id2 in countryAreaData[s1]) {

                                $("#zjAreaCity").append(" <option value='" + id2 + "'>" + id2 + "</option>");
                            }
                            if (typeof (values) == "string") {
                                $("#zjAreaCity option[value=" + values + "]").attr("selected", true)

                            }
                        }
                    </script>
                    <select id="zjAreaProvince">
                        <option value="省份">省份</option>
                    </select>
                    <select id="zjAreaCity">
                        <option value="地市">地市</option>
                    </select>
                    <!--选择城市功能      end      -->
                </div>
                <div class="clear">
                </div>
            </div>
            <!-- 抽取类型 -->
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    <b>2.1、专家抽取类型：</b>
                </div>
                <div class="ui-corner-all" style="width: 25%; float: right; padding: 0.7em;">
                    <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                    选择：当前专家抽取操作的类型；
                </div>
                <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; margin-right: 28%; top: 0px; padding: 0.7em;">
                    <input type="radio" name="rdExtractType" id="extracOption_ZYZJ" value="专业评委" checked="checked" />
                    <label for="extracOption_ZYZJ">
                        专业评委</label>；
                    <input type="radio" name="rdExtractType" id="extracOption_SWZJ" value="商务评委" />
                    <label for="extracOption_SWZJ">
                        商务评委</label>；
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="clear">
            </div>
            <!-- 抽取专家的搜索分类 -->
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    <b>2.2、专家分类：</b>
                </div>
                <div class="ui-corner-all" style="width: 25%; float: right; padding: 0.7em;">
                    <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                    请勾选所要检索的专家的所属分类。
                </div>
                <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; margin-right: 28%; top: 0px; padding: 0.7em;">
                    <div class="ui-corner-all" style="margin-right: 0; padding: 0.3em; height: 120px; width: 90%; overflow: scroll; background-color: #fff;">
                        <ul id="treeCategory" class="ztree">
                        </ul>
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="clear">
            </div>
            <!-- 抽取专家的搜索专业 -->
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    <b>2.3、专家专业：</b>
                </div>
                <div class="ui-corner-all" style="width: 25%; float: right; padding: 0.7em;">
                    <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                    请设置所要检索的专家专业
                </div>
                <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; margin-right: 28%; top: 0px; padding: 0.7em;">
                    <input type="text" style="width: 90%;" id="txtProfessional" />
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="clear">
            </div>
            <!-- 通知方式 -->
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    <b>2.4、抽取数量：</b>
                </div>
                <div class="ui-corner-all" style="width: 25%; float: right; padding: 0.7em;">
                    <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                    设置一次性自动抽取的专家数量
                    <div id="msg">
                    </div>
                </div>
                <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; margin-right: 28%; top: 0px; padding: 0.7em;">
                    <input type="text" id="txtExtracCount" value="5" style="width: 90%;" />
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="clear">
            </div>
            <!-- 通知方式 -->
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    <b>2.5、通知方式：</b>
                </div>
                <div class="ui-corner-all" style="width: 25%; float: right; padding: 0.7em;">
                    <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                    选择：<br />
                    <b>自动方式</b>，由系统自动拨号通知随机抽取的评标专家；
                    <br />
                    <b>手动方式</b>，由工作人员手工拨打随机抽取的评标专家联系电话，确定专家是否参加评标；
                    <br />
                    <div id="msg">
                    </div>
                </div>
                <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; margin-right: 28%; top: 0px; padding: 0.7em;">
                    <input type="radio" name="noticeOption" id="extracOption_A" value="A" />
                    <label for="extracOption_A" style="color: Lime;">
                        自动</label>；
                    <input type="radio" name="noticeOption" id="extracOption_M" value="M" checked="checked" />
                    <label for="extracOption_M" style="color: Red;">
                        手动</label>；
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="clear">
            </div>
        </div>
    </div>
    <!-- 根据抽取选项检索备选专家列表 -->
    <div>
        <h3>
            <a href="#">3、备选专家查询</a></h3>
        <div>
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    操作：
                </div>
                <div class="ui-corner-all" style="margin-left: 28%; padding: 0.7em;">
                    <a href="javascript:getExperts();"><span class="ui-icon ui-icon-search" style="float: left; margin-right: .3em;"></span>
                        3.1、点击这里获取符合抽取选项的备选专家</a>
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="clear">
            </div>
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    <b>备选专家信息<a href="javascript:showExpert();">》</a></b>
                </div>
                <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; top: 0px; padding: 0.7em;">
                    <span style="font-size: 1.2em;">本次查询符合条件的专家：</span>
                    <span style="font-size: 2em; color: red;" id="expertCount">0</span>
                    <span style="font-size: 1.2em;">位；</span>
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="clear">
            </div>
            <div id="expList"></div>
        </div>
    </div>
    <!-- 专家抽取操作 -->
    <div>
        <h3>
            <a href="#">4、专家抽取操作</a></h3>
        <!-- 操作栏 -->
        <div>
            <div style="position: relative; width: 100%; margin: 0.7em 0;">
                <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                    <b>抽取操作：</b>
                </div>
                <div class="ui-corner-all" style="width: 25%; float: right; padding: 0.7em;">
                    <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                    设置抽取选项、获取备选专家后，点击按钮进行抽取操作；
                </div>
                <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; margin-right: 28%; top: 0px; padding: 0.7em;">
                    <a href="javascript:extract();" class="btn" id="doExtract"><span class="ui-icon ui-icon-play"
                        style="float: left; margin-right: .3em;" id="doExtractIcon"></span><span id="doExtractCaption">4.1、开始</span></a>
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="clear">
            </div>
            <!-- 抽取结果栏 -->
            <div class="ui-widget-header ui-corner-all" style="width: 25%; float: left; padding: 0.7em;">
                <b>抽取结果及操作：</b>
            </div>
            <div class="ui-corner-all" style="width: 25%; float: right; padding: 0.7em;">
            </div>
            <div class="ui-widget-content ui-corner-all" style="margin-left: 28%; margin-right: 28%; top: 0px; padding: 0.7em;">
                <!-- 结果栏 -->
                <label id="expertBXLB" style="font-size: 6em;">
                    随机选取
                </label>
            </div>
            <div class="clear">
            </div>
        </div>
    </div>
    <!-- 专家抽取结果 -->
    <div>
        <h3>
            <a href="#">5、结果列表</a></h3>
        <div>
            <div style="position: relative; width: 100%;">
                <div style="padding: 0.7em;">
                    <input type="button" value="5.1、抽取记录导出Excel" id="doSave" class="btn" onclick="exportThisExtract()" />
                    <input type="button" value="5.2、抽取记录打印" id="doPrint" class="btn" onclick="window.location.href = '@Url.Action("PrintExtract", new { extractID = Model.extractRecordID })'" />
                </div>
                <div class="clear">
                </div>
            </div>
            <!-- 详细记录列表的模板 -->
            <script id="DataTemplate_Details" type="text/html">
                {{if dIsOK > 0 }}
                <!-- 参加评标的专家 -->
                <tr>
                    <td style="padding: .5em; text-align: center;" class="ui-state-default">{{= rowIDX }}
                    </td>
                    <td style="padding: .5em; text-align: center;" class="ui-state-default">{{= dType }}
                    </td>
                    <td style="padding: .5em; text-align: center;" class="ui-state-default">{{= expName }}
                    </td>
                    <td style="padding: .5em;" class="ui-state-default">{{= expCompany }}
                    </td>
                    <td style="padding: .5em;" class="ui-state-default">{{= expPhone }}
                    </td>
                    <td style="padding: .5em;" class="ui-state-default">{{= expTitle }}
                    </td>
                    <td style="padding: .5em; text-align: center;" class="ui-state-default">
                        <a href="javascript:editThisDetail('${dId}')">
                            <strong>参加评标</strong></a><div style="color:#888;">
                        {{= dDescribe }}
                            </div>
                    </td>
                </tr>
                {{else}}
                <tr>
                    <td style="padding: .5em; text-align: center;" class="ui-state-default">{{= rowIDX }}
                    </td>
                    <td style="padding: .5em; text-align: center;" class="ui-state-default">{{= dType }}
                    </td>
                    <td style="padding: .5em; text-align: center; color: #BBB;" class="ui-state-default">{{= expName }}
                    </td>
                    <td style="padding: .5em; color: #BBB;" class="ui-state-default">{{= expCompany }}
                    </td>
                    <td style="padding: .5em; color: #BBB;" class="ui-state-default">{{= expPhone }}
                    </td>
                    <td style="padding: .5em; color: #BBB;" class="ui-state-default">{{= expTitle }}
                    </td>
                    <td style="padding: .5em; text-align: center;" class="ui-state-default">
                        <a href="javascript:editThisDetail('${dId}')">
                            <strong><span style="color: red;">不</span>参加评标</strong></a>
                        <div style="color:#888;">
                        {{= dDescribe }}
                            </div>
                    </td>
                </tr>
                {{/if}} 
            </script>
            <!-- 抽取结果的表格 -->
            <table style="border-collapse: collapse; width: 100%;">
                <thead>
                    <tr>
                        <th class="ui-widget-header" style="padding: .5em; white-space: nowrap;">序号
                        </th>
                        <th class="ui-widget-header" style="padding: .5em; white-space: nowrap;">专家类型
                        </th>
                        <th class="ui-widget-header" style="padding: .5em; white-space: nowrap;">姓名
                        </th>
                        <th class="ui-widget-header" style="padding: .5em;">工作单位
                        </th>
                        <th class="ui-widget-header" style="padding: .5em;">联系号码
                        </th>
                        <th class="ui-widget-header" style="padding: .5em;">职称
                        </th>
                        <th class="ui-widget-header" style="padding: .5em;">抽取结果及记录
                        </th>
                    </tr>
                </thead>
                <tbody id="tableDetails">
                </tbody>
            </table>
        </div>
    </div>
</div>
<!-- 编辑详细记录的弹出窗 -->
<div id="FormEdit">
    <div style="position: relative; width: 100%; margin: 0.7em 0;">
        <p><span id="FormEditDetail_ExpertName" style="font-size:1.5em; font-weight:bold;"></span><span id="FormEditDetail_ExpertMobile"></span></p>
        <p><span id="FormEditDetail_ExpertCompany"></span>[<span id="FormEditDetail_ExpertTitle"></span>]</p>
    </div>
    <div style="position: relative; width: 100%; margin: 0.7em 0;">
        <div class="ui-widget-header ui-corner-all" style="width: 35%; float: left; padding: 0.7em;">
            <b>是否参加本次评标：</b>
        </div>
        <div class="ui-widget-content ui-corner-all" style="margin-left: 38%; top: 0px; padding: 0.7em 0.4em;">
            <input id="FormEditDetail_isSelected" type="checkbox" />
            <label for="FormEditDetail_isSelected">参加评标</label>
        </div>
        <div class="clear">
        </div>
    </div>
    <div style="position: relative; width: 100%; margin: 0.7em 0;">
        <div class="ui-widget-header ui-corner-all" style="width: 35%; float: left; padding: 0.7em;">
            <b>抽取信息：</b>
        </div>
        <div class="ui-widget-content ui-corner-all" style="margin-left: 38%; top: 0px; padding: 0.7em 0.4em;">
            <textarea id="FormEditDetail_describe"></textarea>
            <input type="hidden" id="FormEditDetail_Id"/>
        </div>
        <div class="clear">
        </div>
    </div>
    <div style="position: relative; width: 100%; margin: 0.7em 0;"></div>
</div>
